from backend.api.connection import POOL
# from connection import POOL   # 单独运行用这个
import datetime

# 同步计划
# 返回
# {
#  'data':[1,2,3,4……]
#  'ok': 1,
#  'msg':''}
def checkInRecord(pid):
    conn = POOL.connection()
    cur = conn.cursor()
    response = {'data': [], 'ok': 0, 'msg': ''}

    sql = "SELECT check_in_info FROM planlist WHERE pid = {}".format(pid)
    cur.execute(sql)
    result = cur.fetchone()[0]

    response['data'] = result.split(",")[:-1]
    response['ok'] = 1
    print(response)
    return response


if __name__ == '__main__':
    checkInRecord(1)
